<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<jsp:include page="../../header.jsp" />
<h2>部门结构</h2>
<div class="department-tree">
    <ul>
        <c:forEach var="dept" items="${departments}">
            <c:if test="${dept.parentId == 0}">
                <li>
                        ${dept.name}
                    <c:set var="children" value="${departmentDAO.getSubDepartments(dept.id)}" />
                    <c:if test="${not empty children}">
                        <ul>
                            <c:forEach var="child" items="${children}">
                                <li>${child.name}</li>
                            </c:forEach>
                        </ul>
                    </c:if>
                </li>
            </c:if>
        </c:forEach>
    </ul>
</div>
<a href="department" class="btn">返回列表</a>
<jsp:include page="../../footer.jsp" />